<template>
    <div
        id="loading"
        :class="{
            loadingShow: data.loading,
            areoClose: !data.saveData.AeroState
        }"
    >
        <div>
            <el-icon><Loading /></el-icon>
            <p>{{ props.loadingText }}</p>
        </div>
    </div>
</template>

<script setup lang="ts">
import data from "@/data/data";
import { defineProps } from "vue";
import { Loading } from "@element-plus/icons-vue";

const props = defineProps<{
    loadingText?: string;
}>();
</script>

<style scoped lang="less">
#loading {
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--themeColor);
    visibility: hidden;
    opacity: 0;
    font-size: 0.8rem;

    > div {
        text-align: center;

        .el-icon {
            animation: loading 1s infinite linear;
            font-size: 1.2rem;
        }

        @keyframes loading {
            0% {
                transform: rotate(0deg);
            }
            100% {
                transform: rotate(360deg);
            }
        }
    }
}

.loadingShow {
    visibility: visible !important;
    opacity: 1 !important;
}

.areoClose {
    backdrop-filter: none !important;
    background-color: rgba(0, 0, 0, 0.7) !important;
}
</style>
